echo "I am running";
DIR=$1;
FILENAME=$2;
EXT=`echo $FILENAME|awk -F . '{print $NF}'`


if [ -d $DIR/$FILENAME ]
then
	echo "We got a directory"
	find $DIR/$FILENAME -name '*.jpg'|while read Filenametemp ;
	do
	convert $Filenametemp `dirname $Filenametemp`/`basename $Filenametemp .jpg`.png
	rm $Filenametemp
	done
else 
	echo "We got a File"
	echo "we are running " $DIR " and " $FILENAME "__________" $EXT
	if [ $EXT == "jpg" ]
	then
		convert $DIR/$FILENAME $DIR/`basename $FILENAME .jpg`.png
		rm $DIR/$FILENAME
	fi
fi
